home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / gv21.zip / GV.BAS < prev    next >
BASIC Source File  |  1995-03-28  |  12KB  |  379 lines

  1. Option Explicit
  2. DefInt A-Z
  3.  
  4. ' Graphics Viewer
  5. ' Written by: Joe C. Oliphant
  6. ' CompuServe 71742, 1451
  7. ' E-Mail joe_oliphant@csufresno.edu
  8.  
  9.  
  10. ' Type defs for bitmaps
  11. Type BMPHEAD
  12.     ID As String * 2
  13.     FileSize As Long
  14.     reserved(1) As Integer
  15.     HeaderSize As Long
  16. End Type
  17.  
  18. Type BITMAPINFOHEADER
  19.     biSize As Long
  20.     biWidth As Long
  21.     biHeight As Long
  22.     biPlanes As Integer
  23.     biBitCount As Integer
  24.     biCompression As Long
  25.     biSizeImage As Long
  26.     biXPelsPerMeter As Long
  27.     biYPelsPerMeter As Long
  28.     biClrUsed As Long
  29.     BiClrImportant As Long
  30. End Type
  31.  
  32. Type BITMAPINFO
  33.     bmiHeader As BITMAPINFOHEADER
  34.     bmiColors As String * 1024
  35. End Type
  36.  
  37. ' Type defs for CUT Files
  38. Type CUTHEAD
  39.     Width As Integer
  40.     Height As Integer
  41.     Key As Integer
  42. End Type
  43.       
  44. ' Type defs for GIF files
  45. Type GIFHEADER
  46.     GIF As String * 6
  47.     Width As Integer
  48.     Height As Integer
  49.     Flags As String * 1
  50.     Background As String * 1
  51.     Aspect As String * 1
  52. End Type
  53.  
  54. Type IMAGEBLOCK
  55.     left As Integer
  56.     top As Integer
  57.     Width As Integer
  58.     Height As Integer
  59.     Flags As String * 1
  60. End Type
  61.  
  62. Type PLAINTEXT
  63.     BlockSize As String * 1
  64.     left As Integer
  65.     top As Integer
  66.     GridWidth As Integer
  67.     GridHeight As Integer
  68.     CellWidth As String * 1
  69.     CellHeight As String * 1
  70.     ForeColor As String * 1
  71.     BackColor As String * 1
  72. End Type
  73.  
  74. Type CONTROLBLOCK
  75.     BlockSize As String * 1
  76.     Flags As String * 1
  77.     Delay As Integer
  78.     TransParent_Color As String * 1
  79.     Terminator As String * 1
  80. End Type
  81.  
  82. Type APPLICATION
  83.     BlockSize As String * 1
  84.     ApplString As String * 8
  85.     Authentication As String * 3
  86. End Type
  87.  
  88. ' Type def for IFF/LBM files
  89. Type IFFHEAD
  90.     Ftype As String * 4
  91.     Size As String * 4
  92.     SubType As String * 4
  93. End Type
  94.  
  95. Type BMHD
  96.     W As String * 2
  97.     h As String * 2
  98.     X As String * 2
  99.     Y As String * 2
  100.     nPlanes As String * 1
  101.     Masking As String * 1
  102.     Compression As String * 1
  103.     Pad1 As String * 1
  104.     TransparentColor As String * 2
  105.     XAspect As String * 1
  106.     YAspect As String * 1
  107.     PageW As String * 2
  108.     PageH As String * 2
  109. End Type
  110.  
  111. ' Type defs for MAC files
  112. Type MACHEAD
  113.     ZeroByte As String * 1
  114.     Name As String * 64
  115.     Type As String * 4
  116.     Creator As String * 4
  117.     Filler As String * 10
  118.     DataFork_Size As String * 4
  119.     RsrcFork_Size As String * 4
  120.     Creation_Date As String * 4
  121.     Modif_Date As String * 4
  122.     Filler2 As String * 29
  123. End Type
  124.  
  125. ' Type def for MSP files
  126. Type MSPHEAD
  127.     Key1 As Integer
  128.     Key2 As Integer
  129.     Width As Integer
  130.     Height As Integer
  131.     ScrAspX As Integer
  132.     ScrAspY As Integer
  133.     PrnAspX As Integer
  134.     PrnAspY As Integer
  135.     PrndX As Integer
  136.     PrndY As Integer
  137.     Wcheck As Integer
  138.     Res1 As Integer
  139.     Res2 As Integer
  140.     Res3 As Integer
  141. End Type
  142.  
  143. ' Type def for PCX files
  144. Type PCXHEAD
  145.     Manufacturer As String * 1
  146.     Version As String * 1
  147.     Encoding As String * 1
  148.     Bits_Per_Pixel As String * 1
  149.     XMin As Integer
  150.     YMin As Integer
  151.     XMax As Integer
  152.     YMax As Integer
  153.     HRes As Integer
  154.     VRes As Integer
  155.     Palette As String * 48
  156.     reserved As String * 1
  157.     Color_Planes As String * 1
  158.     Bytes_Per_Line As Integer
  159.     Palette_Type As Integer
  160.     Filler As String * 58
  161. End Type
  162.  
  163. ' Type def for PIC files
  164. Type PICHEAD
  165.     Mark As Integer
  166.     XSize As Integer
  167.     YSize As Integer
  168.     XOff As Integer
  169.     YOff As Integer
  170.     BitsInf As String * 1
  171.     Emark As String * 1
  172.     EVideo As String * 1
  173.     EDesc As Integer
  174.     ESize As Integer
  175. End Type
  176.  
  177. ' Type def for TGA files
  178. Type TGAHEAD
  179.     IdentSize As String * 1
  180.     ColorMapType As String * 1
  181.     ImageType As String * 1
  182.     ColorMapStart As Integer
  183.     ColorMapLength As Integer
  184.     ColorMapBits As String * 1
  185.     XStart As Integer
  186.     YStart As Integer
  187.     Width As Integer
  188.     Height As Integer
  189.     Bits As String * 1
  190.     Descriptor As String * 1
  191. End Type
  192.  
  193. ' Type def for TIF files
  194. Type TIFFTAG
  195.     Tag As Long
  196.     Type As Long
  197.     Length As Long
  198.     Offset As Long
  199. End Type
  200.  
  201. ' Type defs for WMF files
  202. Type RECT
  203.     left As Integer
  204.     top As Integer
  205.     right As Integer
  206.     bottom As Integer
  207. End Type
  208.  
  209. Type METAFILEHEADER
  210.     Key As Long
  211.     hMF As Integer
  212.     bbox As RECT
  213.     inch As Integer
  214.     reserved As Long
  215.     checksum As Integer
  216. End Type
  217.  
  218. Type METAHEADER
  219.     mtType As Integer
  220.     mtHeaderSize As Integer
  221.     mtVersion As Integer
  222.     mtSize As Long
  223.     mtNoObjects As Integer
  224.     mtMaxRecord As Long
  225.     mtNoParameters As Integer
  226. End Type
  227.  
  228. ' Type defs for WPG files
  229. Type WPGHEAD
  230.     ID As String * 4
  231.     Start As Long
  232.     Product As String * 1
  233.     Filetype As String * 1
  234.     MajorVersion As String * 1
  235.     Minorversion As String * 1
  236.     Encrypt As Integer
  237.     reserved As Integer
  238. End Type
  239.  
  240. Type STARTRECORD
  241.     Version As String * 1
  242.     Flags As String * 1
  243.     ScreenWidth As Integer
  244.     ScreenHeight As Integer
  245. End Type
  246.  
  247. Type COLORMAP
  248.     StartIndex As Integer
  249.     PalleteSize As Integer
  250. End Type
  251.  
  252. Type BITMAP
  253.     Width As Integer
  254.     Height As Integer
  255.     Bits As Integer
  256.     XResolution As Integer
  257.     YResolution As Integer
  258. End Type
  259.       
  260. ' Type defs for displaying logical fonts
  261. Type LOGFONT
  262.     lfHeight As Integer
  263.     lfWidth As Integer
  264.     lfEscapement As Integer
  265.     lfOrientation As Integer
  266.     lfWeight As Integer
  267.     lfItalic As String * 1
  268.     lfUnderline As String * 1
  269.     lfStrikeOut As String * 1
  270.     lfCharSet As String * 1
  271.     lfOutPrecision As String * 1
  272.     lfClipPrecision As String * 1
  273.     lfQuality As String * 1
  274.     lfPitchAndFamily As String * 1
  275.     lfFaceName As String * 32
  276. End Type
  277.  
  278. Type TEXTMETRIC
  279.     tmHeight As Integer
  280.     tmAscent As Integer
  281.     tmDescent As Integer
  282.     tmInternalLeading As Integer
  283.     tmExternalLeading As Integer
  284.     tmAveCharWidth As Integer
  285.     tmMaxCharWidth As Integer
  286.     tmWeight As Integer
  287.     tmItalic As String * 1
  288.     tmUnderlined As String * 1
  289.     tmStruckOut As String * 1
  290.     tmFirstChar As String * 1
  291.     tmLastChar As String * 1
  292.     tmDefaultChar As String * 1
  293.     tmBreakChar As String * 1
  294.     tmPitchAndFamily As String * 1
  295.     tmCharSet As String * 1
  296.     tmOverhang As Integer
  297.     tmDigitizedAspectX As Integer
  298.     tmDigitizedAspectY As Integer
  299. End Type
  300.  
  301. Global Const BITSPIXEL = 12
  302. Global Const GMEM_MOVEABLE = &H2
  303. Global Const HORZRES = 8
  304. Global Const LB_SETTABSTOPS = &H413
  305. Global Const MM_ANISOTROPIC = 8
  306. Global Const PLANES = 14
  307. Global Const RASTERCAPS = 38
  308. Global Const SRCCOPY = &HCC0020
  309. Global Const VERTRES = 10
  310.  
  311.  
  312. Global Const M_SOF0 = &HC0
  313. Global Const M_SOF1 = &HC1
  314. Global Const M_SOF2 = &HC2
  315. Global Const M_SOF3 = &HC3
  316. Global Const M_SOF5 = &HC5
  317. Global Const M_SOF6 = &HC6
  318. Global Const M_SOF7 = &HC7
  319. Global Const M_SOF9 = &HC9
  320. Global Const M_SOF10 = &HCA
  321. Global Const M_SOF11 = &HCB
  322. Global Const M_SOF13 = &HCD
  323. Global Const M_SOF14 = &HCE
  324. Global Const M_SOF15 = &HCF
  325. Global Const M_SOI = &HD8
  326. Global Const M_EOI = &HD9
  327. Global Const M_SOS = &HDA
  328. Global Const M_COM = &HFE
  329.  
  330.  
  331. Declare Function CreateCompatibleDC% Lib "GDI" (ByVal hDC%)
  332. Declare Function CreateFontIndirect% Lib "GDI" (lpLogFont As LOGFONT)
  333. Declare Function DeleteDC% Lib "GDI" (ByVal hDC%)
  334. Declare Function DeleteMetaFile% Lib "GDI" (ByVal hMF%)
  335. Declare Function DeleteObject% Lib "GDI" (ByVal hObject%)
  336. Declare Function GetDeviceCaps% Lib "GDI" (ByVal hDC%, ByVal nIndex%)
  337. Declare Function GetMetaFile% Lib "GDI" (ByVal lpFilename$)
  338. Declare Function GetTextMetrics% Lib "GDI" (ByVal hDC%, lpMetrics As TEXTMETRIC)
  339. Declare Function GlobalAlloc% Lib "Kernel" (ByVal wFlags%, ByVal dwBytes&)
  340. Declare Function GlobalFree% Lib "Kernel" (ByVal hMem%)
  341. Declare Function GlobalLock& Lib "Kernel" (ByVal hMem%)
  342. Declare Function GlobalUnlock% Lib "Kernel" (ByVal hMem%)
  343. Declare Function lread% Lib "Kernel" Alias "_lread" (ByVal hFile%, ByVal lpBuffer&, ByVal wBytes%)
  344. Declare Function PlayMetaFile% Lib "GDI" (ByVal hDC%, ByVal hMF%)
  345. Declare Function RestoreDC% Lib "GDI" (ByVal hDC%, ByVal nSavedDC%)
  346. Declare Function SaveDC% Lib "GDI" (ByVal hDC%)
  347. Declare Function SelectObject% Lib "GDI" (ByVal hDC%, ByVal hObject%)
  348. Declare Function SendMessage% Lib "User" (ByVal hWnd%, ByVal Msg%, ByVal wParma%, lParam%)
  349. Declare Function SetMapMode% Lib "GDI" (ByVal hDC%, ByVal nMapMode%)
  350. Declare Function SetViewportExt& Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%)
  351. Declare Function SetViewportOrg& Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%)
  352. Declare Function StretchBlt% Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal nSrcWidth%, ByVal nSrcHeight%, ByVal dwRop&)
  353. Declare Function TextOut% Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, ByVal lpString$, ByVal nCount%)
  354.  
  355. Declare Function ReadART% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  356. Declare Function ReadBMP% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  357. Declare Function ReadCUT% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  358. Declare Function ReadGIF% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%, ByVal lpoffset&)
  359. Declare Function ReadHRZ% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  360. Declare Function ReadIFF% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  361. Declare Function ReadIMG% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  362. Declare Function ReadJPG% Lib "vbjpeg.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%, ByVal hdfu%, ByVal htpq%, ByVal hdimeth%, ByVal hdctmeth%)
  363. Declare Function ReadMAC% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  364. Declare Function ReadMSP% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  365. Declare Function ReadPCX% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  366. Declare Function ReadPIC% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  367. Declare Function ReadRAS% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  368. Declare Function ReadTGA% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  369. Declare Function ReadTIF% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  370. Declare Function ReadWPG% Lib "file.dll" (ByVal hfilename$, ByVal hDC%, ByVal hWnd%, ByVal hDither%, ByVal hPrint%, ByVal X%, ByVal Y%, ByVal hScale%)
  371.  
  372.  
  373.  
  374. Declare Function CreateCompatibleBitmap Lib "GDI" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
  375.  
  376.  
  377.  
  378.  
  379.